<?php
// List of already created groups
echo '<h3>' . text::getEscaped('seminarWizard.priceGroup-alreadyCreatedList') . '</h3>';
echo '<ul id="priceGroupList" class="wizardEntityList">';
foreach ($this->data->priceGroupList as $index => $group) {
    echo '<li>' .
         '<span class="hasTooltip">' . $group['name'] . '</span>&nbsp;';
    if ($index > 0) {
         echo html::anchor('admin/seminarWizard/priceGroupDelete?index=' . $index, 'smazat', array('onclick'=>'return confirmDeletion()', 'title'=>text::get('button.delete-title')));
    }
    echo '<div class="tooltip">';
    echo '<p><b>' . text::getEscaped('priceGroup.currency_code') . ':</b> ' . $group['currency']['name'] . ' (' . $group['currency']['code'] . ')</p>';
    if ($group['countries']) {
        echo '<b>' . text::getEscaped('priceGroup.country_codes') . ':</b>';
        echo '<ul>';
        foreach ($group['countries'] as $country) {
            echo '<li>' . $country['name'] . ' (' . $country['code'] . ')</li>';
        }
        echo '</ul>';
    }
    if ($group['description']) {
        echo '<p style="max-width: 300px;"><b>' . text::getEscaped('priceGroup.description') . ':</b> ' . $group['description'] . '</p>';
    }
    echo '</div>';
    echo '</li>';
}
echo '</ul>';

echo '<h3>' . text::getEscaped('seminarWizard.priceGroup-createForm') . '</h3>';

$fb = new FormBuilder('priceGroup', $priceGroup);
$fb->setAction('priceGroupAdd');
$fb->autocompleter('name', $nameAcValues)->required();
$fb->comboBox('currency_code', $currencyOptions)->required();
$fb->selectMany('country_codes', $countryOptions)
        ->required();
$fb->textarea('description');
$fb->button('submit', 'seminarWizard.priceGroup-createButton')->styleClass('primaryAction');
$fb->write();
?>
